import config from './config.js';

export function filterNull(v){
	if(v===0){
		return v;
	}else{
		return uni.$u.test.isEmpty(v)?'--':v;
	}
}

/**
 * 处理图片地址
 * @param {string} url 图片地址
 * @returns 图片地址
 */
export function mmvImageUrl(url) {
    if (uni.$u.test.isEmpty(url)) {
        // return url;
        return 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fhbimg.b0.upaiyun.com%2Ffbf18a5314f750da671711dfb176cf8791fbc687153d-g7YSBF_fw658&refer=http%3A%2F%2Fhbimg.b0.upaiyun.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1648359683&t=f1f85165dfcd41fa2183e748ea2e458d';
    }
    if (uni.$u.test.url(url)) {
        return url;
    }
    if (uni.$u.test.contains(url, 'static/')) {
        return url;
    }
    return config.baseImgUrl() + url;
}

/**
 * 处理图片地址
 * @param {string} url 图片地址
 * @returns 图片地址
 */
export function mmvImageUrl2(url) {
    if (uni.$u.test.isEmpty(url)) {
        // return url;
        return '';
    }
    if (uni.$u.test.url(url)) {
        return url;
    }
    if (uni.$u.test.contains(url, 'static/')) {
        return url;
    }
    return config.baseImgUrl() + url;
}